<template>
    <QilinSearch v-model:searchConfig="searchConfig1" ref="searchConfigRef1"></QilinSearch>
    <QilinSearch v-model:searchConfig="searchConfig" ref="searchConfigRef">
        <template v-slot:production="slotData">
            <el-input 
                v-model="searchConfig.submitData[slotData.data.item.dataName]"
                placeholder="请输入代表作"
            ></el-input>
        </template>
    </QilinSearch>
</template>

<script setup>
import {reactive,ref} from "vue";

/*
    响应式选项区域
*/


/*
    数据变量定义区域
*/
// 获取搜索表单配置项ref
const searchConfigRef=ref(null);
const searchConfigRef1=ref(null);


/*
    计算属性等代码区域
*/


/*
    逻辑脚本代码区域
*/
const searchConfig1 =reactive({
    itemConfig:[
        {
            labelName:"姓名",
            dataName:"name",
            type:"input",
            inputType:"text"
        }
    ],
    buttonConfig:[
        {
            btnName:"查询",
            btnType:"primary",
            btnSize:"default",
            formRefName:searchConfigRef1,
            btnClick:(formRef)=>{
                // console.log(formRef);
                console.log(searchConfig1.submitData);
            }
        },
        {
            btnName:"重置",
            btnType:"default",
            btnSize:"default",
            formRefName:searchConfigRef1,
            btnClick:(formRef)=>{
                console.log(formRef);
                formRef.resetSearchData();
            }
        }
    ],
    submitData:{
        name:""
    }
});

const searchConfig=reactive({
    elFormConfig:{
        labelPosition:"right",
        labelSuffix:"：",
        size:"default"
    },
    itemConfig:[
        {
            labelName:"姓名",
            dataName:"name",
            type:"input",
            inputType:"text"
        },
        {
            labelName:"身份",
            dataName:"identity",
            type:"select",
            dataListName:"identityList",
            multiple:true,
            filterable:false,
            collapseTags:true,
            clear:(item)=>{
                // console.log(item);
            }
        },
        {
            labelName:"出生日期",
            dataName:"birthday",
            type:"date",
            dateType:"date",
            format:"YYYY-MM-DD",
            valueFormat:"YYYY-MM-DD",
            width:160
        },
        {
            labelName:"代表作",
            dataName:"production",
            type:"slot",
            slotName:"production"
        }
    ],
    moreConfig:{
        isShowMore:true
    },
    moreItemConfig:[
        {
            labelName:"工作区间",
            dataName:"workInterval",
            type:"date",
            dateType:"daterange",
            format:"YYYY-MM-DD",
            valueFormat:"YYYY-MM-DD"
        },
        {
            labelName:"参与项目",
            dataName:"projectName",
            type:"select",
            dataListName:"projectNameList"
        },
        {
            labelName:"项目所属",
            dataName:"projectOwn",
            type:"cascader",
            dataListName:"projectOwnList",
            cascaderProps:{
                label:"name",
                value:"id",
                children:"children"
            }
        }
    ],
    selectLists:{
        identityList:[
            {
                label:"学生",
                value:0,
                isHide:true
            },
            {
                label:"程序员",
                value:1
            },
            {
                label:"作者",
                value:2
            },
            {
                label:"打工人",
                value:3
            }
        ],
        projectNameList:[
            {
                label:"看守所、戒毒所、拘留所等项目",
                value:0
            },
            {
                label:"SDP零信任项目",
                value:1
            },
            {
                label:"动态应用安全防护系统BSG",
                value:2
            },
            {
                label:"云上贵州项目",
                value:3
            },
            {
                label:"红花街道h5项目",
                value:4
            },
            {
                label:"温州市党政机关信息化项目",
                value:5
            },
            {
                label:"U创办公管理系统",
                value:6
            },
            {
                label:"U创办公小程序项目",
                value:7
            }
        ],
        projectOwnList:[
            {
                name:"南京冠霆智能科技有限公司",
                id:1,
                children:[
                    {
                        name:"看守所项目",
                        id:11
                    },
                    {
                        name:"拘留所项目",
                        id:12
                    },
                    {
                        name:"戒毒所项目",
                        id:13
                    },
                    {
                        name:"安康医院项目",
                        id:14
                    }
                ]
            },
            {
                name:"亚信安全有限公司",
                id:2,
                children:[
                    {
                        name:"亚信智网有限公司",
                        id:21,
                        children:[
                            {
                                name:"SDP零信任项目",
                                id:211
                            },
                            {
                                name:"动态应用安全防护系统BSG",
                                id:212
                            }
                        ]
                    }
                ]
            },
            {
                name:"苏软科技（南京）有限公司",
                id:3,
                children:[
                    {
                        name:"云上贵州项目",
                        id:31
                    },
                    {
                        name:"红花街道h5项目",
                        id:32
                    },
                    {
                        name:"温州市党政机关信息化项目",
                        id:33
                    }
                ]
            },
            {
                name:"南京联创智慧城市科技有限公司",
                id:4,
                children:[
                    {
                        name:"U创办公管理系统",
                        id:41
                    },
                    {
                        name:"U创办公小程序",
                        id:42
                    }
                ]
            }
        ]
    },
    buttonConfig:[
        {
            btnName:"查询",
            btnType:"primary",
            btnSize:"default",
            formRefName:searchConfigRef,
            btnClick:(formRef)=>{
                // console.log(formRef);
                console.log(searchConfig.submitData);
            }
        },
        {
            btnName:"重置",
            btnType:"default",
            btnSize:"default",
            formRefName:searchConfigRef,
            btnClick:(formRef)=>{
                console.log(formRef);
                formRef.resetSearchData();
            }
        }
    ],
    submitData:{
        name:"",
        identity:"",
        birthday:"",
        production:"",
        workInterval:"",
        projectName:"",
        projectOwn:""
    }
});


/*
    生命周期等代码区域
*/


</script>

<style lang="scss" scoped>
.qilin-{

}
</style>
